package tests;

import logic.Book;
import logic.Teacher;
import logic.User;

import org.junit.*;

import static org.junit.Assert.*;

/**
 * The class <code>BookTest</code> contains tests for the class <code>{@link Book}</code>.
 *
 * @author Cesar
 */
public class BookTest {
	/**
	 * Run the Book(User,User,String,String,String,boolean) constructor test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testBook_1()
		throws Exception {
		User owner = new Teacher("", "", "", "", "");
		User holder = new Teacher("", "", "", "", "");
		String title = "";
		String author = "";
		String isbn = "";
		boolean available = true;

		Book result = new Book(owner, holder, title, author, isbn, available);

		
		assertNotNull(result);
		assertEquals(true, result.available());
		assertEquals("", result.getTitle());
		assertEquals("", result.getAuthor());
		assertEquals("", result.getISBN());
	}

	/**
	 * Run the boolean available() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testAvailable_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		boolean result = fixture.available();

		
		assertEquals(true, result);
	}

	/**
	 * Run the boolean available() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testAvailable_2()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", false);

		boolean result = fixture.available();

		assertEquals(false, result);
	}

	
	/**
	 * Run the boolean equals(Object) method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testEquals_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);
		Object obj = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		boolean result = fixture.equals(obj);

		
		assertEquals(true, result);
	}

	/**
	 * Run the boolean equals(Object) method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testEquals_2()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);
		Object obj = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		boolean result = fixture.equals(obj);

		
		assertEquals(true, result);
	}

	/**
	 * Run the boolean equals(Object) method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testEquals_3()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);
		Object obj = new Object();

		boolean result = fixture.equals(obj);

		
		assertEquals(false, result);
	}

	/**
	 * Run the String getAuthor() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testGetAuthor_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		String result = fixture.getAuthor();

		
		assertEquals("", result);
	}

	/**
	 * Run the User getHolder() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testGetHolder_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		User result = fixture.getHolder();

		
		assertNotNull(result);
		assertEquals("User [firstName=, lastName=, email=, password=]Teacher [sala=]", result.toString());
		assertEquals("", result.getPassword());
		assertEquals("", result.getLastName());
		assertEquals("", result.getFirstName());
		assertEquals("", result.getEmail());
	}

	/**
	 * Run the String getISBN() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testGetISBN_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		String result = fixture.getISBN();

		
		assertEquals("", result);
	}

	/**
	 * Run the User getOwner() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testGetOwner_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		User result = fixture.getOwner();

		
		assertNotNull(result);
		assertEquals("User [firstName=, lastName=, email=, password=]Teacher [sala=]", result.toString());
		assertEquals("", result.getPassword());
		assertEquals("", result.getLastName());
		assertEquals("", result.getFirstName());
		assertEquals("", result.getEmail());
	}

	/**
	 * Run the double getRate() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test(expected = java.lang.Exception.class)
	public void testGetRate_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		double result = fixture.getRate();

		
		assertEquals(0.0, result, 0.1);
	}

	/**
	 * Run the double getRate() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test(expected = java.lang.Exception.class)
	public void testGetRate_2()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		double result = fixture.getRate();

		
		assertEquals(0.0, result, 0.1);
	}

	/**
	 * Run the double getRate() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test(expected = java.lang.Exception.class)
	public void testGetRate_3()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		double result = fixture.getRate();

		
		assertEquals(0.0, result, 0.1);
	}

	/**
	 * Run the String getTitle() method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testGetTitle_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);

		String result = fixture.getTitle();

		
		assertEquals("", result);
	}

	/**
	 * Run the void rate(String,int) method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testRate_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);
		String userId = "";
		int points = 1;

		fixture.rate(userId, points);

		
	}

	/**
	 * Run the void rate(String,int) method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test(expected = java.lang.Exception.class)
	public void testRate_2()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);
		String userId = "";
		int points = 0;

		fixture.rate(userId, points);

		
	}

	/**
	 * Run the void rate(String,int) method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test(expected = java.lang.Exception.class)
	public void testRate_3()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);
		String userId = "";
		int points = 6;

		fixture.rate(userId, points);

		
	}

	/**
	 * Run the void setAvailable(boolean) method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testSetAvailable_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);
		boolean available = true;

		fixture.setAvailable(available);

		
	}

	/**
	 * Run the void setHolder(User) method test.
	 *
	 * @throws Exception
	 *
	 */
	@Test
	public void testSetHolder_1()
		throws Exception {
		Book fixture = new Book(new Teacher("", "", "", "", ""), new Teacher("", "", "", "", ""), "", "", "", true);
		User holder = new Teacher("", "", "", "", "");

		fixture.setHolder((Teacher)holder);

	}

	public static void main(String[] args) {
		new org.junit.runner.JUnitCore().run(BookTest.class);
	}
}